package com.zuxia.controller;


import com.zuxia.dto.balance.BalanceDto;
import com.zuxia.dto.commission.CommissionDto;
import com.zuxia.entity.Balance;
import com.zuxia.param.BalanceParam;
import com.zuxia.param.UserParam;
import com.zuxia.service.BalanceService;
import com.zuxia.utils.R;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author laoli
 * @since 2024-11-19
 */
@RestController
@RequestMapping("/user/balance")
public class BalanceController {
    @Resource
    private BalanceService balanceService;

    @ApiOperation("收支明细")
    @PostMapping("/getBalance")
    public R getEntry(@RequestBody BalanceParam param){
        List<Balance> balance = balanceService.getBalance(param);
        return R.ok().message("收支明细查询").data("balance-getBalance",balance);
    }

    @ApiOperation("支出和收入的总账")
    @PostMapping("/getMoney")
    public R getYue(){
        BalanceDto yue = balanceService.yue();
        return R.ok().message("待入账的钱").data("balance-getMoney",yue);
    }
}
